/*
 * @Author: Simon 1958058172@qq.com
 * @Date: 2025-08-13 11:40:51
 * @LastEditors: Simon 1958058172@qq.com
 * @LastEditTime: 2025-08-13 19:24:27
 * @FilePath: \java.1212\csdn\jihe\li08\work01.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package csdn.jihe.li08;

import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;

public class work01 {
    public static void main(String[] args) {
         Comparator<Integer> comparator=new Comparator<Integer>(){
            @Override
            public int compare(Integer o1, Integer o2){
                int num;
                if(o1%2!=0){ if(o2%2!=0){num=o1.compareTo(o2); return num; }   return -1;}
                else { if(o2%2==0){num=o2.compareTo(o1);return num;} return 1;}
            }
         };

        Set<Integer> tree=new TreeSet<>(comparator);
        for(int i=1;i<=10;i++){
            tree.add(i);
        }
        System.out.println(tree);
        
    }
}
